home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97b.txt / 000065_icon-group-sender _Tue Sep 16 08:00:33 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by cheltenham.cs.arizona.edu (8.8.7/8.8.7) with SMTP id IAA07333
  4.     for <icon-group-addresses@cheltenham.CS.Arizona.EDU>; Tue, 16 Sep 1997 08:00:32 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA02458; Tue, 16 Sep 1997 08:00:32 -0700
  7. To: icon-group@cs.arizona.edu
  8. Date: Tue, 16 Sep 1997 22:56:57 +1000
  9. From: Stuart.Robinson@anu.edu.au (Stuart Robinson)
  10. Message-Id: <Stuart.Robinson-1609972256580001@asianstmg-221.anu.edu.au>
  11. Organization: ANU
  12. Sender: icon-group-request@cs.arizona.edu
  13. Subject: Problem with Program
  14. Errors-To: icon-group-errors@cs.arizona.edu
  15. Status: RO
  16.  
  17.  
  18. I just wrote up a little program to check each line of text for the number
  19. of times the string "#PL" appears.  I want the program to put the line in
  20. list_1 if the string shows up once, in list_2 if the string shows up
  21. twice, in list_3 if the string show up three times, and in list_other if
  22. it fails to show up at all or shows up more than three times.  The problem
  23. is, it doesn't work.  What gives?  Thanks in advance.
  24.  
  25. ==========
  26.  
  27. #16 Sept 1997
  28. #program written to print all clauses in which plurality is multiply marked
  29.  
  30. procedure main()
  31.  
  32. list_1 := []
  33. list_2 := []
  34. list_3 := []
  35. otherlist_other := []
  36.  
  37. chars := &letters++-#7
  38. count := 0
  39.  
  40. while line := read() do    
  41.    {
  42.    line ?
  43.       {           
  44.       while tab(upto(chars)) do
  45.          {
  46.          word := tab(many(chars))
  47.          word ?
  48.             {
  49.             if find("#PL") then count +:= 1
  50.             {
  51.          }
  52.       }
  53.  
  54.    if count = 1 then put(list_1, line)
  55.    else if count = 2 then put(list_2, line)
  56.    else if count = 3 then put(list_3, line)
  57.    else put(list_other, line)
  58.  
  59.    count := 0
  60.    }
  61.  
  62. write ("\n" || "LINES WITH PLURAL MARKED ONE TIME")
  63. every write(list_1[1 to *list_1])
  64.  
  65. write ("\n" || "LINES WITH PLURAL MARKED TWO TIMES")
  66. every write(list_2[1 to *list_2])
  67.  
  68. write ("\n" || "LINES WITH PLURAL MARKED THREE TIMES")
  69. every write(list_3[1 to *list_3])
  70.  
  71. write ("\n" || "ALL OTHER LINES")
  72. every write(list_other[1 to *list_other])
  73.  
  74. end
  75.  
  76. -- 
  77. Stuart Robinson <Stuart.Robinson@no_spam!anu.edu.au>
  78. The Australian National University
  79. *TO REPLY, REMOVE "no_spam!" FROM E-MAIL ADDRESS GIVEN ABOVE
  80.